/**
 *
 * by littlefean
 */
let d = document;
d.get = d.querySelector;

/**
 *
 * @param class_ {String}
 * @param text {String}
 * @return {HTMLDivElement}
 */
function div(class_, text) {
    let res = d.createElement("div");
    res.innerText = text;
    res.classList.add(class_)
    return res;
}

function color100Str(number) {
    return `rgba(${255 * (number / 100)}, 100, ${255 * (1 - number / 100)})`;
}

/**
 * 创造一个数组的元素div
 * @param text
 * @return {HTMLDivElement}
 */
function divItem(text) {
    let number = +text;
    let res = div("ArrayItem", text);
    res.style.position = ""
    res.style.backgroundColor = color100Str(number);
    res.style.color = "white";
    return res;
}

/**
 * 生成一个辅助数组里的div元素
 * @param text
 * @return {HTMLDivElement}
 */
function divHelpItem(text) {
    let number = +text;
    let res = div("HelpArrayItem", text);
    res.style.position = ""
    res.style.backgroundColor = color100Str(number);
    res.style.color = "white";
    return res;
}

function arrLast(arr) {
    return arr[arr.length - 1];
}

function rand01() {
    return Math.floor(Math.random() * 2);
}
